package com.feiniu.api.service.impl;

import com.feiniu.api.dao.TestDaoIn;
import com.feiniu.api.pojo.TestPojo;
import com.feiniu.api.service.TestServiceIn;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class TestServiceImpl implements TestServiceIn {

	@Autowired
	private TestDaoIn testDaoIn;

	@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
	public List<TestPojo> query(int pageNo, int pageSize) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("startIndex", (pageNo - 1) * pageSize);
		map.put("pageSize", pageSize);
		return testDaoIn.query(map);
	}

}
